import axios from "axios"
export const getlist=(data)=>{
    return{
        type:"GETLIST",
        payload:data
    }   
   }
   export const  fetchlist=(params={page:1})=>{
       return dispatch=>{
           var url=`http://localhost:3000/product?_page=${params.page}&_limit=6&_sort=id&_order=desc`
           axios({
               url:url,
               method:"get"
           }).then(res=>{
               console.log(res.headers);
               var obj={
                   rows:res.data,
                   totle:res.headers['x-total-count']
               }
               dispatch(getlist(obj));
           })
       }
     
   }